package ch9.ex25;

import static ch9.print.Print.*;
import ch9.ex24.*;

class  GreenHouseControlsWithWMG extends GreenHouseControlsWithFan {
	private boolean generator = false;
	
	public class WaterMistGeneratorOn extends Event{
		public WaterMistGeneratorOn(long delayTime){
			super(delayTime);
		}

		public void action() {
			generator = true;
		}
		public String toString(){
			return "Water mist generator is on";
		}
	}
	public class WaterMistGeneratorOff extends Event{

		public WaterMistGeneratorOff(long delayTime) {
			super(delayTime);
		}

		public void action() {
			generator = false;
		}
		public String toString(){
			return "Water mist generator is off";
		}
	}
}

public class GreenHouseController{

	public static void main(String[] args){
		GreenHouseControlsWithWMG gc = new GreenHouseControlsWithWMG();
		gc.addEvent(gc.new Bell(900));
		Event[] eventList = {
				gc.new ThermostatNight(0),
				gc.new LightOn(200),
				gc.new LightOff(400),
				gc.new WaterOn(600),
				gc.new WaterOff(800),
				gc.new ThermostatDay(1400),
				gc.new WaterMistGeneratorOn(1600),
				gc.new WaterMistGeneratorOff(1800)
				
		};
		gc.addEvent(gc.new Restart(2000, eventList));
		gc.addEvent(new GreenHouseControlsWithWMG.Terminate(5L));
		gc.run();
	}
}
